#!/bin/sh
echo "do gen proto"
cd $(dirname "$0")

project_dir=$1
base_dir="${project_dir}/gen/main"

# gen java proto
java_out=${base_dir}/java
mkdir -p ${java_out}
rm -rf ${java_out}"/com/tmindtech/api/model/protobuf"
protoc --java_out=${java_out} \
    --proto_path=${project_dir}/src/main/proto \
    ${project_dir}/src/main/proto/*.proto

# gen kotlin builder
kotlin_out=${base_dir}/kotlin
mkdir -p ${kotlin_out}
rm -rf ${kotlin_out}"/com/tmindtech/api/model/protobuf"
java -jar kbuilders.jar --javaRoot=${java_out} --kotlinRoot=${kotlin_out}

